import Main from '@/components/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
  path: '/login',
  name: 'login',
  meta: {
    title: 'Login - 登录'
  },
  component: () => import('@/components/login.vue')
};

export const page404 = {
  path: '/*',
  name: 'error-404',
  meta: {
    title: '404-页面不存在'
  },
  component: () => import('@/components/error-page/404.vue')
};

export const page403 = {
  path: '/403',
  meta: {
    title: '403-权限不足'
  },
  name: 'error-403',
  component: () => import('@/components/error-page/403.vue')
};

export const page500 = {
  path: '/500',
  meta: {
    title: '500-服务端错误'
  },
  name: 'error-500',
  component: () => import('@/components/error-page/500.vue')
};

export const preview = {
  path: '/preview',
  name: 'preview',
  component: () => import('@/components/form/article-publish/preview.vue')
};

export const locking = {
  path: '/locking',
  name: 'locking',
  component: () => import('@/components/main-components/lockscreen/components/locking-page.vue')
};

export const otherRouter = {
  path: '/',
  name: 'otherRouter',
  redirect: '/home',
  component: Main,
  children: [
    { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: () => import('@/components/home/home.vue') },
    { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: () => import('@/components/own-space/own-space.vue') },
    { path: 'subjectmod', title: '栏目管理', name: 'subject_mod', component: () => import('@/components/base/subjectmod.vue') },
    { path: 'bannermod', title: 'banner图管理', name: 'banner_mod', component: () => import('@/components/base/bannermod.vue') },
    { path: 'contextmod', title: '内容管理', name: 'context_mod', component: () => import('@/components/base/contextmod.vue') },
    { path: 'projectmod', title: '课程管理', name: 'project_mod', component: () => import('@/components/teacher/projectmod.vue') },
    { path: 'coursemod', title: '报名管理', name: 'course_mod', component: () => import('@/components/teacher/coursemod.vue') },
    { path: 'sourcemod', title: '成绩管理', name: 'source_mod', component: () => import('@/components/teacher/sourcemod.vue') },
    { path: 'thesismod', title: '论文管理', name: 'thesis_mod', component: () => import('@/components/teacher/thesismod.vue') },
    { path: 'addStduent', title: '添加学生', name: 'add_stduent', component: () => import('@/components/teacher/addstduent.vue') },
    { path: 'classmod', title: '班级管理', name: 'class_mod', component: () => import('@/components/teacher/classmod.vue') },
    { path: 'activityMod', title: '活动管理', name: 'activity_mod', component: () => import('@/components/teacher/activityMod.vue') },
    { path: 'mastermod', title: '大师管理', name: 'master_mod', component: () => import('@/components/base/mastermod.vue') },
    { path: 'adminmod', title: '用户管理', name: 'admin_mod', component: () => import('@/components/teacher/adminmod.vue') },
    // { path: 'order/:order_id', title: '订单详情', name: 'order-info', component: () => import('@/views/advanced-router/component/order-info.vue') }, // 用于展示动态路由
    // { path: 'shopping', title: '购物详情', name: 'shopping', component: () => import('@/views/advanced-router/component/shopping-info.vue') }, // 用于展示带参路由
    // { path: 'message', title: '消息中心', name: 'message_index', component: () => import('@/views/message/message.vue') }
  ]
};

export const appRouter = [
  {
    path: '/baseSet',
    icon: 'key',
    name: 'baseSet',
    title: '网站基本设置',
    access: 'baseSet',
    component: Main,
    children: [
      { path: 'index', title: '网站基本设置', name: 'base_set', component: () => import('@/components/base/baseset.vue') }
    ]
  },
  {
    path: '/subjectSet',
    icon: 'lock-combination',
    title: '栏目设置',
    name: 'subjectSet',
    access: 'subjectSet',
    component: Main,
    children: [
      { path: 'index', title: '栏目设置', name: 'subject_set', component: () => import('@/components/base/subjectset.vue') }
    ]
  },
  {
    path: '/banner',
    icon: 'earth',
    title: 'banner图管理',
    name: 'banner',
    access: 'banner',
    component: Main,
    children: [
      { path: 'index', title: 'banner图管理', name: 'banner_index', component: () => import('@/components/base/banner.vue') }
    ]
  },
  {
    path: '/context',
    icon: 'android-sad',
    title: '内容管理',
    name: 'context',
    access:'context',
    component: Main,
    children: [
      { path: 'index', title: '内容管理', name: 'context_index', component: () => import('@/components/base/context.vue') }
    ]
  },
  {
    path: '/activity',
    icon: 'android-sad',
    title: '报名管理',
    name: 'activity',
    access:'activity',
    component: Main,
    children: [
      { path: 'index', title: '报名管理', name: 'activity_index', component: () => import('@/components/stduent/activity.vue') }
    ]
  },
  {
    path: '/course',
    icon: 'android-sad',
    title: '课程管理',
    name: 'course',
    access:'course',
    component: Main,
    children: [
      { path: 'index', title: '课程管理', name: 'course_index', component: () => import('@/components/stduent/course.vue') }
    ]
  },
  {
    path: '/personinfo',
    icon: 'android-sad',
    title: '个人信息',
    name: 'personinfo',
    access:'personinfo',
    component: Main,
    children: [
      { path: 'index', title: '个人信息', name: 'personinfo_index', component: () => import('@/components/stduent/personinfo.vue') }
    ]
  },
  {
    path: '/source',
    icon: 'android-sad',
    title: '成绩管理',
    name: 'source',
    access:'source',
    component: Main,
    children: [
      { path: 'index', title: '成绩管理', name: 'source_index', component: () => import('@/components/stduent/source.vue') }
    ]
  },
  {
    path: '/thesis',
    icon: 'android-sad',
    title: '论文管理',
    name: 'thesis',
    access:'thesis',
    component: Main,
    children: [
      { path: 'index', title: '论文管理', name: 'thesis_index', component: () => import('@/components/stduent/thesis.vue') }
    ]
  },
  {
    path: '/stduentinfo',
    icon: 'android-sad',
    title: '在线申请管理',
    name: 'stduentInfo',
    access:'stduentInfo',
    component: Main,
    children: [
      { path: 'index', title: '在线申请管理', name: 'stduentinfo_index', component: () => import('@/components/teacher/stduentInfo.vue') }
    ]
  },
  {
    path: '/admininfo',
    icon: 'android-sad',
    title: '管理员信息',
    name: 'adminInfo',
    access:'adminInfo',
    component: Main,
    children: [
      { path: 'index', title: '管理员信息', name: 'adminInfo_index', component: () => import('@/components/teacher/adminInfo.vue') }
    ]
  },
  {
    path: '/project',
    icon: 'android-sad',
    title: '课程管理',
    name: 'project',
    access:'project',
    component: Main,
    children: [
      { path: 'index', title: '课程管理', name: 'project_index', component: () => import('@/components/teacher/project.vue') }
    ]
  },
  {
    path: '/courseinfo',
    icon: 'android-sad',
    title: '报名管理',
    name: 'courseinfo',
    access:'courseInfo',
    component: Main,
    children: [
      { path: 'index', title: '报名管理', name: 'courseInfo_index', component: () => import('@/components/teacher/courseInfo.vue') }
    ]
  },
  {
    path: '/scoreinfo',
    icon: 'android-sad',
    title: '成绩管理',
    name: 'scoreinfo',
    access:'scoreInfo',
    component: Main,
    children: [
      { path: 'index', title: '成绩管理', name: 'scoreInfo_index', component: () => import('@/components/teacher/sourceInfo.vue') }
    ]
  },
  {
    path: '/thesisinfo',
    icon: 'android-sad',
    title: '论文管理',
    name: 'thesisinfo',
    access:'thesisInfo',
    component: Main,
    children: [
      { path: 'index', title: '论文管理', name: 'thesisInfo_index', component: () => import('@/components/teacher/thesisInfo.vue') }
    ]
  },
  {
    path: '/classinfo',
    icon: 'android-sad',
    title: '班级管理',
    name: 'classinfo',
    access:'classInfo',
    component: Main,
    children: [
      { path: 'index', title: '班级管理', name: 'classInfo_index', component: () => import('@/components/teacher/classinfo.vue') }
    ]
  },
  {
    path: '/stdinfo',
    icon: 'android-sad',
    title: '学生管理',
    name: 'stdinfo',
    access:'stdInfo',
    component: Main,
    children: [
      { path: 'index', title: '学生管理', name: 'stdInfo_index', component: () => import('@/components/teacher/stdinfo.vue') }
    ]
  },
  {
    path: '/activityset',
    icon: 'android-sad',
    title: '活动管理',
    name: 'activityset',
    access:'activityset',
    component: Main,
    children: [
      { path: 'index', title: '活动管理', name: 'activityset_index', component: () => import('@/components/teacher/activityset.vue') }
    ]
  },
  {
    path: '/masterset',
    icon: 'android-sad',
    title: '大师管理',
    name: 'masterset',
    access:'masterset',
    component: Main,
    children: [
      { path: 'index', title: '大师管理', name: 'masterset_index', component: () => import('@/components/base/master.vue') }
    ]
  },
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
  loginRouter,
  otherRouter,
  // preview,
  locking,
  ...appRouter,
  page500,
  page403,
  page404
];
